<%@ page import="lesbonsamis.Projet" %>
<%@ page import="lesbonsamis.Depense" %>
<html>
    <head>
        <meta name="layout" content="main" />
    </head>
    
    <body>
		<div data-role="page">		
		    <g:form name="formulaire" action="sauver">
			    <div data-role="header">
				    <h1>Modif. dépense</h1>
			    </div>

			    <div data-role="content">					
				    <input id="id" type="hidden" name="id" value="${depense?.id}" />
				        
				    <div data-role="fieldcontain">
					    <label for="nom"><em>* </em>Quoi?</label>
					    <g:textField name="nom" value="${depense?.nom}" minlength="3" maxlength="50" class="required" />
				    </div>
				    
				    <div data-role="fieldcontain">
					    <label for="montant"><em>* </em>Combien?</label>
					    <g:textField name="montant" value="${depense?.montant}" class="required" />
				    </div>
				    			    
				    <div data-role="fieldcontain">
					    <label for="payeurId"><em>* </em>Qui a payé?</label>
					    <g:select name="payeurId" from="${listeParticipant}" optionValue="nom" optionKey="${{it.id}}" value="${depense?.payeur?.id}" data-native-menu="false" class="required" />
				    </div>
				    			    
				    <div data-role="fieldcontain">
					    <label for="consommateursId"><em>* </em>Qui a participé?</label>
					    <g:select name="consommateursId" from="${listeParticipant}" optionValue="nom" optionKey="${{it.id}}" value="${depense?.consommateurs?.id}" multiple="multiple" noSelection="['':'Selectionner...']" data-native-menu="false" class="required" />
				    </div>
				    
				    <fieldset class="ui-grid-a">
		        		<div class="ui-block-a"><g:link controller="depense" action="liste" data-role="button" data-icon="arrow-l">Annuler</g:link></div>
						<div class="ui-block-b"><g:submitButton name="sauver" value="OK" data-icon="check" data-theme="b"/></div>
	        		</fieldset>
				</div>
            </g:form>
	        
	        <script type="text/javascript">
    			$('[data-role=page]').live('pageshow', function () {   
  			    	$('#formulaire').validate();
  				});
	        </script>	
		</div>
	</body>
</html>
